package enum02;

/**
 * 一周(星期一~星期日)
 * 1.我们为一周每天定义一个Week()对象,每个Week对象都代表改天
 */
public class Week {

	/**
	 * 私有化构造方法目的:只能使用Week类中的这七个对象
	 * 而不能在类外再创建该类的对象
	 */
	private Week() {

	}

	private String weekName;//代表星期的名称

	private Week(String weekName) {
		this.weekName = weekName;
	}

	/**
	 * public:保证权限足够大,在类外以及不同的包下都能访问
	 * static:不需要在类外创建对象,可以通过类名直接调用
	 * final:final修饰变量,该变量只能被赋值一次,该变量就成为常量
	 * 常量的命名规范,变量名纯大写 XXX_XXX_XXX
	 */
	/*public static final Week MONDAY = new Week();
	public static final Week TUESDAY = new Week();
	public static final Week WEDNESDAY = new Week();
	public static final Week THURSDAY = new Week();
	public static final Week FRIDAY = new Week();
	public static final Week SATURDAY = new Week();
	public static final Week SUNDAY = new Week();*/

	public static final Week MONDAY = new Week("星期一");
	public static final Week TUESDAY = new Week("星期二");
	public static final Week WEDNESDAY = new Week("星期三");
	public static final Week THURSDAY = new Week("星期四");
	public static final Week FRIDAY = new Week("星期五");
	public static final Week SATURDAY = new Week("星期六");
	public static final Week SUNDAY = new Week("星期日");

	@Override
	public String toString() {
		//return "星期一";
		return weekName;
	}
}
